#ifndef _CERTIFICATE_ENTRY_HPP
#define _CERTIFICATE_ENTRY_HPP

#include <boost/shared_ptr.hpp>
#include "../constants.hpp"
#include "HistoryDigest.hpp"
#include "CommandBatch.hpp"
#include "NonDeterminism.hpp"

namespace BFT
{
	namespace messages
	{
		class CertificateEntry
		{
			public:
			
			CertificateEntry( boost::shared_ptr<HistoryDigest> _hd,
					  boost::shared_ptr<CommandBatch> _commands,
					  boost::shared_ptr<NonDeterminism> _nd,
					  boost::shared_ptr<Digest> _cp);
			
			CertificateEntry( boost::shared_ptr<char> _bytes, int _bytes_size, int offset);
			
			boost::shared_ptr<HistoryDigest> getHistoryDigest();
			boost::shared_ptr<Digest> getCPHash();
			boost::shared_ptr<NonDeterminism> getNonDeterminism();
			boost::shared_ptr<CommandBatch> getCommandBatch();
			boost::shared_ptr<Digest> getDigest();
			
			bool equals(boost::shared_ptr<CertificateEntry> _other_ce);
			//int getSize();
			//boost::shared_ptr<char> getBytes();
			boost::shared_ptr<char> getBytes(int& _bytes_size); 		  
			
			void printInfo();
			
			protected:
			
			boost::shared_ptr<HistoryDigest> hd;
			boost::shared_ptr<Digest> cphash;
			boost::shared_ptr<CommandBatch> commands;
			boost::shared_ptr<NonDeterminism> nd;
			boost::shared_ptr<char> bytes;
			boost::shared_ptr<Digest> digest;
			int bytes_size;
		};
		
		inline boost::shared_ptr<HistoryDigest> CertificateEntry::getHistoryDigest() { return hd;}
		inline boost::shared_ptr<Digest> CertificateEntry::getCPHash() {return cphash;}
		inline boost::shared_ptr<CommandBatch> CertificateEntry::getCommandBatch() { return commands;}
		inline boost::shared_ptr<NonDeterminism> CertificateEntry::getNonDeterminism() { return nd;}
		//inline int CertificateEntry::getSize() {return bytes_size};
		inline boost::shared_ptr<Digest> CertificateEntry::getDigest() {return digest;}
	}
}

#endif
